<template>
    <rx-dialog @handOk="handOk" @cancel="cancel">
        <rx-layout>
            <div slot="center">
                <rx-fit>
                    <rx-monacoeditor ref="monacoes"
                                    class="monacoBox"
                                    :language="language"
                                    v-model="localVal">
                        <template v-slot:monacoeditor>
                            <rx-process-handle-dialog :attr-list="attrList" @selectType="selectType"></rx-process-handle-dialog>
                        </template>
                    </rx-monacoeditor>
                </rx-fit>

            </div>
        </rx-layout>
    </rx-dialog>
</template>

<script>
    import {Util,RxLayout,RxDialog,RxFit,RxMonacoEditor,Dialog} from "@lowcode/jpaas-common-lib"
    import RxProcessHandleDialog   from './rx-process-handle-dialog';

    export default {
        name: 'rx-monaco-edit-dialog',
        components: {
            RxProcessHandleDialog,
            RxLayout,
            RxDialog,
            RxFit,
            RxMonacoEditor

        },
        props:{
            layerid: {
                type: String,
                default: ""
            },
            destroy: {
                type: Function
            },
            monacoValue:{
                type: String,
                default: ""
            },
            /**
             * 属性列表。
             */
            attrList: {
                type: Array,
                default: []
            },
            /**
            * 语言。
            */
            language:{
              type: String,
              default: "java"
            }
        },
        data() {
            return {

                localVal:""
            }
        },
        created(){
            this.localVal=this.monacoValue;
        },
        methods: {

            selectType(val){
                this.$refs.monacoes.insertContent (val)
            },
            cancel(){
                Util.closeWindow(this,"cancel");
            },
            handOk(){
                Util.closeWindow(this,"ok",this.localVal);
            },
            getData(){
                return this.localVal;
            },

        }
    }
</script>
<style scoped>

</style>

